博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js 多选选择删除数据
阅读量:6991 次
发布时间:2019-06-27

本文共 3375 字,大约阅读时间需要 11 分钟。

按了顶上的删除(多项删除)

单列复选框删除 js语句

1 删除
1 

 

多列复选框删除js语句

先在table外套个form表单 并且指定id,其中给复选框指定name 和 value

<td><input type="checkbox" name="ids" value="${customer.id}"/></td>

1     
2
3 ............4
5
1     

参考

1 <%@ page language="java" contentType="text/html; charset=utf-8" 2     pageEncoding="utf-8"%> 3 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <%@taglib uri="http://www.WFReduceContent.com" prefix="reduce"%> 5  6  7  8 
9 Insert title here10 11 12
13
14
15
16
17
18
添加 多重删除
19
33
20
21
22
23
24
25
26
27
28
29
30
31
32
34
35
36
37
38
39
40
41
42
43
45
46 47
选择 姓名 性别 生日 电话 email 爱好 类型 描述 操作
${customer.name} ${customer.gender=="1"?"男":"女"} ${customer.birthday} ${customer.cellphone} ${customer.email} ${customer.hobby} ${customer.type}
编辑44 删除
48
84
85 86 87
View Code
1 package cn.itcast.Controller; 2  3 import java.io.IOException; 4 import javax.servlet.ServletException; 5 import javax.servlet.annotation.WebServlet; 6 import javax.servlet.http.HttpServlet; 7 import javax.servlet.http.HttpServletRequest; 8 import javax.servlet.http.HttpServletResponse; 9 10 import cn.itcast.service.CustomerService;11 import cn.itcast.service.impl.CustomerServiceImpl;12 13 public class DelCustomerServlet extends HttpServlet {14     private static final long serialVersionUID = 1L;15     private CustomerService service= new CustomerServiceImpl();16     public DelCustomerServlet() {17         super();18     }19 20     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {21         String method=request.getParameter("method");22         if("delMultiple".equals(method))            //多重删除23         {24             String ids[]=request.getParameterValues("ids");25             if(null!=ids&&ids.length>0)26                 for(String id:ids)27                     service.delCustomerById(id);28             request.getRequestDispatcher("ShowAllCustomer").forward(request, response);29             return;30         }31         //单条删除32         String customerId=request.getParameter("customerId");33         System.out.println( "servlet"+customerId);34         service.delCustomerById(customerId.trim());35         request.getRequestDispatcher("ShowAllCustomer").forward(request, response);36     }37     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {38         this.doGet(request, response);39     }40 41 }
View Code

 

转载于:https://www.cnblogs.com/friends-wf/p/3745159.html

你可能感兴趣的文章
Java课程上机实验1_ConnectionManager
查看>>
node.js中通过dgram数据报模块创建UDP服务器和客户端
查看>>
FZU Tic-Tac-Toe -.- FZU邀请赛 FZU 2283
查看>>
外痔田螺用法
查看>>
异常:由于代码已经过优化或者本机框架位于调用堆栈之上,无法计算表达式的值...
查看>>
nginx访问静态文件配置
查看>>
mysql索引
查看>>
ubuntu server 14.04 上安装jdk1.8
查看>>
python file.tell() 在windows下需要注意的地方
查看>>
10种简单的数字滤波C语言源程序算法
查看>>
oracle 中 dual 详解
查看>>
HDU1870 愚人节的礼物【堆栈+输入输出】
查看>>
什么是并发用户数?并发用户数怎么计算?
查看>>
1、Linux基础认识
查看>>
Git在Githib和Github上的使用
查看>>
visual studio 编辑窗口 设置固定选项卡 使窗口选项卡多行显示
查看>>
处在LV1太长了··
查看>>
软件工程综合实践阶段小结
查看>>
人工神经网络简介
查看>>
改善我们的神经网络
查看>>